﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <link href="../../Content/style.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            width: 100%;
            
        }
        .style2
        {
            width: 100%;
            background-color:White;               
        }
    </style>
</head>
<body style="background:#e1d1d6;">
    <table class="style2" cellspacing="5">
        <tr style="background-color:#507CD1; font-weight:bold; Color:White; text-align:center;">
            <td>
                Name</td>
            <td>
                Category</td>
            <td>
                Supplier</td>
            <td>
                Image</td>
            <td>
                Description</td>
            <td>
                Price</td>
            <td>
                Number</td>
            <td>
                Delete</td>
        </tr>
        <% if (Session["table"] != null)
           {
               GIFT_SHOP_MVC.Models.GiftShop_LinQDataContext data = new GIFT_SHOP_MVC.Models.GiftShop_LinQDataContext();
               List<GIFT_SHOP_MVC.Models.SanPham> arrProduct = (List<GIFT_SHOP_MVC.Models.SanPham>)Session["table"];
               for (int i=0;i<= arrProduct.Count -1;i++)
               {
                   GIFT_SHOP_MVC.Models.SanPham product = (GIFT_SHOP_MVC.Models.SanPham)arrProduct[i];
                   GIFT_SHOP_MVC.Models.TheLoai category = data.TheLoais.Single(c => c.MaTheLoai == product.MaTheLoai);
                   GIFT_SHOP_MVC.Models.NhaCungCap supplier = data.NhaCungCaps.Single(s => s.MaNhaCungCap == product.MaNhaCungCap);
                   %>
                  <tr style="background-color:#D1DDF1; font-weight:bold; Color:#333333; text-align:center;">
                    <td>
                        <%=product.TenSanPham%></td>
                    <td>
                        <%=category.TenTheLoai%></td>
                    <td>
                        <%=supplier.TenNhaCungCap%></td>
                    <td>
                        <img src="<%=product.Hinh%>" width="80" height="80" alt="" /></td>
                    <td>
                        <%=product.MoTa%></td>
                    <td>
                        <%=product.Gia%></td>
                    <td>
                        <%=product.SL_Ton%></td>
                    <td>
                        <a href="../../Admin/DeleteTable/<%=i %>" target="main_frame" >Delete</a></td>
                </tr>
               <%}
           } %>
    </table>
</body>
</html>
